package com.siyougame.business.dal.mysql.inspectItem;

import java.util.*;

import com.siyougame.common.pojo.PageResult;
import com.siyougame.mybatis.mybatis.core.query.LambdaQueryWrapperX;
import com.siyougame.mybatis.mybatis.core.mapper.BaseMapperX;
import com.siyougame.business.dal.dataobject.inspectItem.InspectItemDO;
import org.apache.ibatis.annotations.Mapper;
import com.siyougame.business.controller.admin.inspectItem.vo.*;

/**
 * 检查记录明细 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface InspectItemMapper extends BaseMapperX<InspectItemDO> {

    default PageResult<InspectItemDO> selectPage(InspectItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectItemDO>()
                .eqIfPresent(InspectItemDO::getInspectId, reqVO.getInspectId())
                .eqIfPresent(InspectItemDO::getTempId, reqVO.getTempId())
                .likeIfPresent(InspectItemDO::getTempName, reqVO.getTempName())
                .eqIfPresent(InspectItemDO::getTempItemId, reqVO.getTempItemId())
                .eqIfPresent(InspectItemDO::getTempItemContent, reqVO.getTempItemContent())
                .eqIfPresent(InspectItemDO::getCheckV, reqVO.getCheckV())
                .eqIfPresent(InspectItemDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InspectItemDO::getRemark, reqVO.getRemark())
                .eqIfPresent(InspectItemDO::getSortRank, reqVO.getSortRank())
                .eqIfPresent(InspectItemDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(InspectItemDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByAsc(InspectItemDO::getOrdNum));
    }

    default List<InspectItemDO> selectList(InspectItemExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InspectItemDO>()
                .eqIfPresent(InspectItemDO::getInspectId, reqVO.getInspectId())
                .eqIfPresent(InspectItemDO::getTempId, reqVO.getTempId())
                .likeIfPresent(InspectItemDO::getTempName, reqVO.getTempName())
                .eqIfPresent(InspectItemDO::getTempItemId, reqVO.getTempItemId())
                .eqIfPresent(InspectItemDO::getTempItemContent, reqVO.getTempItemContent())
                .eqIfPresent(InspectItemDO::getCheckV, reqVO.getCheckV())
                .eqIfPresent(InspectItemDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InspectItemDO::getRemark, reqVO.getRemark())
                .eqIfPresent(InspectItemDO::getSortRank, reqVO.getSortRank())
                .eqIfPresent(InspectItemDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(InspectItemDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByAsc(InspectItemDO::getOrdNum));
    }

}